﻿@{
    Layout = "Layout.ControlPanel";
    ViewBag.Title = "Control Panel: Versions";
}

<h1 class="page-header">Versions</h1>

<pre class="raw" style="height: 300px; overflow-y: scroll;">
Please wait while data is being loaded from server...
</pre>

@section scripts
{
    <script type="text/javascript">
        $(function() {

            var versionsUrl = '@Url.Action("GetVersions","ControlPanel")';

            var writeLine = function(line) {
                $(".raw").text($(".raw").text() + line + "\n");
            }

            $.getJSON(versionsUrl, function(data) {
                $(".raw").text("");
                $.each(data, function(key, val) {
                    if (val !== null && typeof val === 'object') {
                        writeLine("");
                        writeLine("[" + key + "]");
                        $.each(val, function(subkey, subval) {
                            if (subkey !== '$type') {
                                writeLine("    " + subkey + " -> " + subval);
                            }
                        });
                    } else {
                        if (key !== '$type') {
                            writeLine(key + ": " + val);
                        }
                    }
                });
            });

        });
    </script>
}
